package com.liefox.staservice.controller;


import com.liefox.commonutils.R;
import com.liefox.staservice.service.StatisticsDailyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 网站统计日数据 前端控制器
 * </p>
 *
 * @author liefox
 * @since 2021-07-23
 */
@RestController
@RequestMapping("/staservice/sta")
//@CrossOrigin
public class StatisticsDailyController {

    @Autowired
    private StatisticsDailyService service;


    @PostMapping("registerCount/{day}")
    public R registerCount(@PathVariable String day){

        service.registerCount(day);
        return R.ok();
    }


    @GetMapping("show-chart/{begin}/{end}/{type}")
    public R showChart(@PathVariable String begin,@PathVariable String
            end,@PathVariable String type){
        Map<String, Object> map = service.getChartData(begin, end, type);
        return R.ok().data(map);
    }
}

